package 笔试.秋招2021.Y2021秋招.网易2021秋招.T2;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        int[] T = new int[m];
        int[] S = new int[n];

        Set<Integer> set = new HashSet<>();
        for(int i=0; i<m; i++) {
            T[i] = sc.nextInt();
            set.add(T[i]);
        }

        int i=0, j=0;
        for(int k=0, l=1; k<(n-m) || j<m; ) {
            while(set.contains(l)) {
                l++;
            }
            if(j < m && l >= T[j]) {
                S[i++] = T[j++];
            } else if(k<(n-m)) {
                S[i++] = l++;
                k++;
            }
        }
        Arrays.stream(S)
              .forEach(o -> System.out.print(o + " "));
    }
}